package com.fanxj.controller;

import com.fanxj.Utils.ResponseData;
import com.fanxj.domain.Relic;
import com.fanxj.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.List;

@Controller
@RequestMapping("/Smart")
public class SmartController {
    @Autowired
    private SearchService searchService;
    @RequestMapping(value = "/smartSearch",produces = "text/html;charset=UTF-8")
    @ResponseBody
    public ResponseData smartSearch(String smartSearchValue) throws IOException {
        List<Relic> relicList=searchService.smartSearch(smartSearchValue);
        ResponseData responseData = ResponseData.ok();
        responseData.putDataValue("relicList", relicList);
        return responseData;
    }

}
